package acwing_01;
import java.util.*;
import java.io.*;
public class _801_二进制中1的个数 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	static int N = 100010;
	static int n;
	static String arr[] = new String[N];
	static int count[] = new int[N];
	static StringTokenizer st;
	public static void main(String[] args) throws IOException{
		n = Integer.parseInt(br.readLine());
		st = new StringTokenizer(br.readLine());
		for(int i = 0; i < n; i++) {
			// 十进制转二进制：Integer.toString(i,2);
			arr[i] = Integer.toString(Integer.parseInt(st.nextToken()), 2);
			for(int j = 0; j < arr[i].length(); j++) {
				if(arr[i].charAt(j) == '1') {
					count[i]++;
				}
			}
			bw.write(count[i] + " ");
		}

		bw.flush();
		bw.close();
		br.close();


	}
}
